﻿
@{
    ViewBag.Title = "Register";
}


<div class="headertwo clearfloat" id="header">
    <a href="javascript:history.go(-1)" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
    <p class="fl">用户注册</p>
</div>
<form id="registerForm">
    <div class="register clearfloat" id="main">
        <ul>
            <li class="clearfloat">
                <p class="tit fl">手机号</p>
                <input type="text" id="phoneNum" value="" name="PhoneNum" class="shuru fl" placeholder="请输入手机号码" />
            </li>
            <li class="clearfloat">
                <p class="tit fl">验证码</p>
                <input type="text"  value="" class="shuru shurutwo fl" placeholder="请输入短信验证码" name="SmsCode" />
                <a href="#loginmodalt" id="modaltrigger">
                    <input type="button" id="getValidCode" value="获取短信验证码" class="btn fr" />
                </a>
            </li>
            <li class="clearfloat">
                <p class="tit fl">密码</p>
                <input type="text" id="" value="" class="shuru fl" placeholder="请设置密码" name="Password" />
            </li>
            <li class="clearfloat">
                <p class="tit fl">确认密码</p>
                <input type="text" id="" value="" class="shuru fl" placeholder="请再次输入密码" name="Password2" />
            </li>
        </ul>
        <a href="#" id="registerBtn" class="pay-btn clearfloat">
            注册
        </a>
        <div class="bottom clearfloat">
            <p class="fl">
                已有账号？
                <a href="/Main/Login">立即登录</a>
            </p>
        </div>
    </div>
</form>

<!--弹窗内容 star-->
<div id="loginmodalt" class="box-s loginmodaltwo" style="display:none;">
    <div class="top clearfloat box-s">
        <p class="tit">请输入图片验证码</p>
        <div class="xia clearfloat">
            <input type="text" id="verfiyCode" value="" name="verfiyCode" class="yzm fl" placeholder="填写图片验证码" />
            <span class="fl"><img id="validCodeImg" src="/Register/GetvaliCode" /></span>
            <i id="sx" class="iconfont icon-shuaxin fr"></i>
        </div>
    </div>
    <form id="loginform" name="loginform" method="post" action="">
        <div class="center fl"><input type="button" name="loginbtn" id="loginbtn" class="hidemodal" value="取消" tabindex="3"></div>
        <div class="center fl"><input type="button" name="loginbtn" id="sendSms" class="" value="确定" tabindex="3"></div>
    </form>
</div>
<!--弹窗内容 end-->

@section Scripts
{
    <script>
        $(function () {
            $("#getValidCode").click(function () {
                var mobile = $("#phoneNum").val();

                $.post("/User/SendSMS", { Mobile: mobile }, function (data) {
                    if (data.State == 1) {
                        //弹出消息提示
                        layer.open({
                            content: data.ErrorMessage
                            , btn: '我知道了'
                        });
                    }
                    //进行倒计时，并且让按钮禁用（课下自行完成）

                }, "json");

            });


            $("#registerBtn").click(function () {

                $.post("/User/SendEmail", null, function (data) {
                    if (data.State == 1) {
                        //弹出消息提示
                        layer.open({
                            content: data.ErrorMessage
                            , btn: '我知道了'
                        });
                    }
                 

                }, "json");

            });

        });

    </script>
}
